<extend name="Base/common"/>

<block name="body">
    <div class="mui-row mui-content-padded">
    	<div class="mui-col-xs-6 snatch_sort">
    		<if condition="$status eq 1">
    		<li><a style="color:red">进行中</a></li>
    		<elseif condition="$status eq 2" />
    		<li><a style="color:red">往期揭晓</a></li>
    		<else />
    		<li><a href="{:U('index',['order_type'=>'view_num'])}"<eq name="order_type" value="view_num"> style="color:red"</eq>>人气</a></li>
    		<li><a href="{:U('index',['order_type'=>'add_time'])}"<eq name="order_type" value="add_time"> style="color:red"</eq>>最新</a></li>
    		<li><a href="{:U('index',['order_type'=>'remaining'])}"<eq name="order_type" value="remaining"> style="color:red"</eq>>剩余人次</a></li>
    		</if>
    	</div>
    	<div class="mui-col-xs-6 div_search">
    		<input type="text" value="{$keyword}" class="input_search" />
    		<span class="mui-icon mui-icon-search" id="btn_search"></span>
    	</div>
    </div>
    <div class="mui-content">
    	<empty name="list">
	    <div class="no_record">
	    	暂未找到相关内容
	    </div>
    	<else />
    	<foreach name="list" item="vo">
	    <neq name="vo.status" value="2">
	    <div class="mui-row snatch_list">
	    	<div class="mui-col-xs-5 snatch_item_img">
	    		<a href="{:U('snatch/detail',['id'=>$vo['id']])}">
	    		<empty name="vo.pic">	    			
		    	<img src="http://placehold.it/335x180"/>
		    	<else />	    			
		    	<img src="{$vo.pic|get_cover='path'}"/>
	    		</empty>
	    		</a>
	    	</div>
	        <div class="mui-col-xs-7">
	        	<div class="snatch_item">
		            <div class="snatch_item_title">
		        		<a href="{:U('snatch/detail',['id'=>$vo['id']])}">
		        		第{$vo.id}期：{$vo.title}</a></div>
		            <div class="mui-row process_info">
		            	<div class="mui-col-xs-9">	            		
		            		<div class="process_bg">
		            			<img src="__IMG__/progress.png" width="{$vo.progress|default='0'}%"/>
		            		</div>
		            		<div class="process_text">
		            			<li style="float: left;">总需:{$vo.total_num}人</li>
		            			<li style="float: right;">剩余:<php>echo ($vo['total_num'] - $vo['num'])</php>人</li>
		            		</div>
		            	</div>
		            	<div class="mui-col-xs-3 img_btn_join" data-id="{$vo.id}" data-status="{$vo.status}" style="padding-top:0">
		            		<eq name="vo.status" value="1">		            			
		            		<a href="{:U('snatch/getCode',array('id'=>$vo['id']))}"><img src="__IMG__/join_red.png"/></a>
		            		<else />	            			
		            		<img src="__IMG__/join_gray.png"/>
		            		</eq>
		            	</div>
		            </div>
	        	</div>
	        </div>
	    </div>
        <else />
        <gt name="vo.lottery_uid" value="0">
	    <div class="mui-row snatch_list">
	    	<div class="mui-col-xs-5 snatch_item_img">
	    		<a href="{:U('snatch/detail',['id'=>$vo['id']])}">
	    		<empty name="vo.pic">	    			
		    	<img src="http://placehold.it/335x180"/>
		    	<else />	    			
		    	<img src="{$vo.pic|get_cover='path'}"/>
	    		</empty>
	    		</a>
	    	</div>
			<div class="mui-col-xs-7 mui-navigate-right">
	        	<div class="snatch_item">
		            <div class="snatch_item_title">
		            	<a href="{:U('snatch/detail',['id'=>$vo['id']])}">
		            	第{$vo.id}期：{$vo.title}</a>
		        	</div>
					<div class="snatch_item_title">
						获奖者:<span>{$vo.lottery_uid|get_username|substr_cut}</span>
					</div>
					<div class="snatch_item_title">
						幸运号码:<span>{$vo.lottery_code}</span>
					</div>
					<div class="snatch_item_title">
						揭晓时间:<span>{$vo.lottery_time|date="Y-m-d H:i",###}</span>
					</div>
				</div>
			</div>	
			</gt>       
	        </neq>
	    </div>
    </div>
    </foreach>
	</empty>
    <div class="page">
    	{$_page}
    </div>
	<div class="float_add_snatch">
		<a href="{:U('snatch/add')}">
			<img src="__IMG__/add_snatch.png">
		</a>
	</div>
	<nav class="mui-bar mui-bar-tab">
	    <a class="mui-tab-item" href="{:U('index/index')}">
	        <span class="mui-icon icon-renpin"></span>
	        <span class="mui-tab-label">人品大爆发</span>
	    </a>
	    <a class="mui-tab-item mui-active" href="{:U('snatch/index')}">
	        <span class="mui-icon icon-huodong"></span>
	        <span class="mui-tab-label">全部活动</span>
	    </a>
	    <a class="mui-tab-item" href="{:U('mine/index')}">
	        <span class="mui-icon icon-mine"></span>
	        <span class="mui-tab-label">我的</span>
	    </a>
	</nav>
</block>
<block name="script">
<script type="text/javascript">	
	mui('.mui-bar-tab').on('tap','a',function(){
		var url = this.attributes['href'].value;
		mui.openWindow({
			url:url
		});
	});
	$("#btn_search").on('click',function(){
		var keyword = $(".input_search").val();
		if(keyword != ''){
			location.href = "{:U('index',['order_type'=>$order_type])}?keyword="+keyword;
		}
	})
</script>
</block>
